# package containing hybrid encryption implementations of PQC primitives

package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

cc_library(
    name = "cecpq2_hybrid_config",
    srcs = ["cecpq2_hybrid_config.cc"],
    hdrs = ["cecpq2_hybrid_config.h"],
    include_prefix = "tink/experimental/pqcrypto/kem/",
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        "//:registry",
        "//aead:aead_config",
        "//config:tink_fips",
        "//hybrid:hybrid_decrypt_wrapper",
        "//hybrid:hybrid_encrypt_wrapper",
        "//util:status",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/memory",
    ],
)

cc_library(
    name = "cecpq2_hybrid_key_templates",
    srcs = ["cecpq2_hybrid_key_templates.cc"],
    hdrs = ["cecpq2_hybrid_key_templates.h"],
    include_prefix = "tink/experimental/pqcrypto/kem/",
    deps = [
        "//aead:aead_key_templates",
        "//daead:deterministic_aead_key_templates",
        "//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "//proto:common_cc_proto",
        "//proto:tink_cc_proto",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "cecpq2_aead_hkdf_dem_helper",
    srcs = ["cecpq2_aead_hkdf_dem_helper.cc"],
    hdrs = ["cecpq2_aead_hkdf_dem_helper.h"],
    include_prefix = "tink/experimental/pqcrypto/kem/",
    deps = [
        "//:aead",
        "//:deterministic_aead",
        "//:registry",
        "//daead/subtle:aead_or_daead",
        "//proto:tink_cc_proto",
        "//util:errors",
        "//util:istream_input_stream",
        "//util:protobuf_helper",
        "//util:secret_data",
        "//util:statusor",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
    ],
)

cc_library(
    name = "cecpq2_aead_hkdf_private_key_manager",
    srcs = ["cecpq2_aead_hkdf_private_key_manager.cc"],
    hdrs = ["cecpq2_aead_hkdf_private_key_manager.h"],
    include_prefix = "tink/experimental/pqcrypto/kem/",
    deps = [
        ":cecpq2_aead_hkdf_dem_helper",
        ":cecpq2_aead_hkdf_public_key_manager",
        "//:core/key_type_manager",
        "//:core/private_key_type_manager",
        "//:hybrid_decrypt",
        "//experimental/pqcrypto/kem/subtle:cecpq2_aead_hkdf_hybrid_decrypt",
        "//experimental/pqcrypto/kem/subtle:cecpq2_subtle_boringssl_util",
        "//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "//proto:tink_cc_proto",
        "//subtle:random",
        "//subtle:subtle_util",
        "//util:enums",
        "//util:secret_data",
        "//util:status",
        "//util:statusor",
        "//util:validation",
        "@boringssl//:crypto",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "cecpq2_aead_hkdf_public_key_manager",
    srcs = ["cecpq2_aead_hkdf_public_key_manager.cc"],
    hdrs = ["cecpq2_aead_hkdf_public_key_manager.h"],
    include_prefix = "tink/experimental/pqcrypto/kem/",
    deps = [
        ":cecpq2_aead_hkdf_dem_helper",
        "//:core/key_type_manager",
        "//:hybrid_encrypt",
        "//experimental/pqcrypto/kem/subtle:cecpq2_aead_hkdf_hybrid_encrypt",
        "//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "//proto:common_cc_proto",
        "//proto:tink_cc_proto",
        "//util:enums",
        "//util:errors",
        "//util:protobuf_helper",
        "//util:status",
        "//util:statusor",
        "//util:validation",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
    ],
)

# tests

cc_test(
    name = "cecpq2_hybrid_config_test",
    size = "small",
    srcs = ["cecpq2_hybrid_config_test.cc"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        ":cecpq2_hybrid_config",
        ":cecpq2_hybrid_key_templates",
        "//:hybrid_decrypt",
        "//:hybrid_encrypt",
        "//:keyset_handle",
        "//:registry",
        "//config:tink_fips",
        "//util:status",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "cecpq2_hybrid_key_templates_test",
    size = "small",
    srcs = ["cecpq2_hybrid_key_templates_test.cc"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_hybrid_config",
        ":cecpq2_hybrid_key_templates",
        "//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "//util:test_matchers",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "cecpq2_aead_hkdf_dem_helper_test",
    size = "small",
    srcs = ["cecpq2_aead_hkdf_dem_helper_test.cc"],
    deps = [
        ":cecpq2_aead_hkdf_dem_helper",
        "//:registry",
        "//aead:aes_gcm_key_manager",
        "//aead:xchacha20_poly1305_key_manager",
        "//config:tink_config",
        "//daead:aes_siv_key_manager",
        "//util:secret_data",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "cecpq2_aead_hkdf_private_key_manager_test",
    srcs = ["cecpq2_aead_hkdf_private_key_manager_test.cc"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        "//:hybrid_decrypt",
        "//:registry",
        "//aead:aead_key_templates",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_gcm_key_manager",
        "//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "//proto:aes_eax_cc_proto",
        "//proto:common_cc_proto",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "cecpq2_aead_hkdf_public_key_manager_test",
    srcs = ["cecpq2_aead_hkdf_public_key_manager_test.cc"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        "//:hybrid_encrypt",
        "//:registry",
        "//aead:aead_key_templates",
        "//aead:aes_gcm_key_manager",
        "//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "//proto:aes_eax_cc_proto",
        "//proto:common_cc_proto",
        "//proto:tink_cc_proto",
        "//util:status",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)
